package org.ipower.examsystem.service;

import java.util.Collection;
import org.ipower.platform.utils.BaseCollection;

/**
 * 题目信息集合。
 * @author young
 */
public class Topics extends BaseCollection<Topic> {
    private static final long serialVersionUID = 1L;
    private Topic parent = null;
    /**
     * 构造函数。
     * @param parent 父题目。
     * */
    public Topics(Topic parent){
        this.parent = parent;
    }
    @Override
    public boolean add(Topic data) {
         if(data != null){
             data.setParent(this.parent);
             super.add(data);
         }
         return false;
     }
    @Override
    public boolean addAll(Collection<? extends Topic> c){
        if(c != null && c.size() > 0){
            for(Topic data: c){
                data.setParent(this.parent);
            }
            super.addAll(c);
        }
        return false;
    }
    @Override
    public int compare(Topic o1, Topic o2) {
        return o1.getOrderNo() - o2.getOrderNo();
    }
}